home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / com2asm2.arc / COM2ASM2.DOC < prev   
Encoding:
Text File  |  1983-10-30  |  2.1 KB  |  69 lines

  1.  
  2.  
  3. For DOS 2.0 
  4.  
  5. I use this program whenever I want to convert a 
  6. COM file to assembler source code, for subsequent
  7. modification and re-assembly.  Here's how it works:
  8.  
  9. Get into debug with the COM file you're working
  10. with, and locate the areas containing the code.
  11. (stay away from the data areas)  Write down the
  12. starting and ending addresses for all the code
  13. areas in the file, and quit.
  14. Back in dos, create a file to be piped into the
  15. standard input of the debug program, containing
  16. the commands necessary to unassemble the program
  17. in the sequence in which it resides in ram.
  18. The easiest way to do this is to use the copy 
  19. command. 
  20.  
  21. A>copy con file1
  22. u addr1 addr2  <-- unassemble the file
  23. u addr3 addr4
  24. .    (etc.)
  25. .
  26. q              <-- DON'T FORGET THIS!
  27. ^Z
  28.  
  29.  1 File(s) copied
  30.  
  31. A>
  32. Now, type
  33. DEBUG (filename).COM  <FILE1  >FILE2
  34.  
  35. This will (given enough time) generate a file 
  36. called FILE2 containing the result of the 
  37. above commands to debug.  Now, run the
  38. COM2ASM.BAS program, enter FILE2 in response
  39. to the "Input file?" prompt, and some other
  40. (new) file name for the output file prompt.
  41. The program will then read file2, get rid of the
  42. hex addresses on the left and the op code, 
  43. label the intra-segment jumps and calls and their
  44. destinations with labels of the form "Ln",
  45. where 0<n<999, and send the results to the other
  46. (new) file.  The result is compatible (as far as
  47. it goes) with the IBM assembler.
  48. If you get "Error: Referenced code not found",
  49. it means that a jump or call was found which
  50. referenced an address not found in the input file.
  51. At this point, processing stops and the address of
  52. the missing code is printed out, followed by
  53. the addresses of referenced code not yet 
  54. processed.
  55. When this happens, it either means you missed 
  56. portions of the code, you got 'unsynchronized' 
  57. during the unassembly (perhaps you started 
  58. unassembling in the middle of an instruction), 
  59. you got into data areas, or (possibly) the code 
  60. modifies itself during execution.  
  61.  
  62. Rich Winkel
  63. Columbia, Mo.
  64. 65399 '** DONE - PRESS ENTER TO RETURN TO MENU **
  65. 
  66.  
  67. odifies itself during execution.  
  68.  
  69. Rich